//统一配置Ajax请求参数
let baseUrl = 'http://www.itcbc.com:8080';
$.ajaxPrefilter(function (option) {
    option.url = baseUrl + option.url;
    option.headers = { Authorization: localStorage.getItem('token') };
    option.complete = function (xhr) {
        let res = xhr.responseJSON;
        // console.log(res);
        if (res && res.status === 1 && res.message === "身份认证失败！") {
            // 提示获取用户信息失败
            layer.msg(res.message, { time: 400 }, function () {
                // 2秒后清空token信令 并返回登录注册页
                localStorage.removeItem('token');
                location.href = './login.html';
            })
        }
    };
})